package com.only4play.practice.ordercenter.core.events;

import com.only4play.practice.ordercenter.api.model.domainmodel.OrderCompleteModel;
import com.only4play.practice.ordercenter.api.model.domainmodel.OrderCreateModel;
import com.only4play.practice.ordercenter.core.entity.OrderBase;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.springframework.context.ApplicationEvent;

public interface OrderEvents {

  /**
   * 订单创建事件
   */
  @EqualsAndHashCode(callSuper = true)
  @Value
  class OrderCreateEvent extends ApplicationEvent {

    OrderBase orderBase;
    OrderCreateModel createModel;
    public OrderCreateEvent(OrderBase orderBase, OrderCreateModel createModel) {
      super(orderBase);
      this.orderBase = orderBase;
      this.createModel = createModel;
    }
  }

  /**
   * 订单完成事件
   */
  @Value
  class OrderCompleteEvent {

    OrderBase orderBase;
    OrderCompleteModel completeModel;

    public OrderCompleteEvent(OrderBase orderBase, OrderCompleteModel completeModel) {
      this.orderBase = orderBase;
      this.completeModel = completeModel;
    }
  }

  /**
   * 订单修订事件
   */
//  @Value
//  class OrderReviseEvent {
//
//    OrderBase orderBase;
//    OrderReviseModel reviseModel;
//
//    public OrderReviseEvent(OrderBase orderBase, OrderReviseModel reviseModel) {
//      this.orderBase = orderBase;
//      this.reviseModel = reviseModel;
//    }
//  }

  /**
   * 订单取消事件
   */
  @Value
  class OrderCancelEvent {

    OrderBase orderBase;

    public OrderCancelEvent(OrderBase orderBase) {
      this.orderBase = orderBase;
    }
  }


}